package com.itheima.day04;

import java.util.Scanner;

/**
 * 查询数组中的元素所在索引位置
 */
public class Demo3 {
    public static void main(String[] args) {
        int []arr={19, 28, 37, 46, 50};
        Scanner sc= new Scanner(System.in);
        System.out.println("请输入您要查找的元素");
        int num = sc.nextInt();
        int index=-1;
        for (int i = 0; i < arr.length; i++) {
            if (num==arr[i]){
                index=i;
                break;
            }
        }
        System.out.println(index);
    }
}
